package com.example.springboottx.service;

import com.example.springboottx.bean.Publisher;
import com.example.springboottx.mapper.PublisherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class PublisherServiceImpl implements PublisherService{

    @Autowired
    private PublisherMapper publisherMapper;

    @Override
    public Publisher addPublisher(String name) throws InterruptedException {
        publisherMapper.addPublisher(name);
        int a=1/0;
        Thread.sleep(5000);
        return new Publisher(0,name,null);
    }

    @Override
    public Publisher findPublisherById(Integer id) {
        return publisherMapper.findPublisherById(id);
    }
}
